package asn.match.model;

// Generated 15 juin 2014 03:03:18 by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.CascadeType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Ressource generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "ressource", catalog = "muslima_sphere")
public class Ressource implements java.io.Serializable {

	private Integer idRessource;
	private RessourceContainer ressourceContainer;
	private String type;
	private String title;
	private String description;
	private String url;
	private String licence;
	private int ordreAffichage;
	private double inFocus;
	private String status;
	private Date createdAt;
	private Date modifiedAt;
	private Set<Like> likes = new HashSet<Like>(0);
	private Set<Comment> comments = new HashSet<Comment>(0);

	public Ressource() {
	}

	public Ressource(RessourceContainer ressourceContainer, String type,
			String url, int ordreAffichage, double inFocus, String status,
			Date createdAt, Date modifiedAt) {
		this.ressourceContainer = ressourceContainer;
		this.type = type;
		this.url = url;
		this.ordreAffichage = ordreAffichage;
		this.inFocus = inFocus;
		this.status = status;
		this.createdAt = createdAt;
		this.modifiedAt = modifiedAt;
	}

	public Ressource(RessourceContainer ressourceContainer, String type,
			String title, String description, String url, String licence,
			int ordreAffichage, double inFocus, String status, Date createdAt,
			Date modifiedAt, Set<Like> likes, Set<Comment> comments) {
		this.ressourceContainer = ressourceContainer;
		this.type = type;
		this.title = title;
		this.description = description;
		this.url = url;
		this.licence = licence;
		this.ordreAffichage = ordreAffichage;
		this.inFocus = inFocus;
		this.status = status;
		this.createdAt = createdAt;
		this.modifiedAt = modifiedAt;
		this.likes = likes;
		this.comments = comments;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_ressource", unique = true, nullable = false)
	public Integer getIdRessource() {
		return this.idRessource;
	}

	public void setIdRessource(Integer idRessource) {
		this.idRessource = idRessource;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ressource_container_id", nullable = false)
	public RessourceContainer getRessourceContainer() {
		return this.ressourceContainer;
	}

	public void setRessourceContainer(RessourceContainer ressourceContainer) {
		this.ressourceContainer = ressourceContainer;
	}

	@Column(name = "type", nullable = false, length = 17)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "title")
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "description", length = 65535)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "url", nullable = false, length = 65535)
	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name = "licence", length = 100)
	public String getLicence() {
		return this.licence;
	}

	public void setLicence(String licence) {
		this.licence = licence;
	}

	@Column(name = "ordre_affichage", nullable = false)
	public int getOrdreAffichage() {
		return this.ordreAffichage;
	}

	public void setOrdreAffichage(int ordreAffichage) {
		this.ordreAffichage = ordreAffichage;
	}

	@Column(name = "in_focus", nullable = false, precision = 8)
	public double getInFocus() {
		return this.inFocus;
	}

	public void setInFocus(double inFocus) {
		this.inFocus = inFocus;
	}

	@Column(name = "status", nullable = false, length = 15)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created_at", nullable = false, length = 19)
	public Date getCreatedAt() {
		return this.createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modified_at", nullable = false, length = 19)
	public Date getModifiedAt() {
		return this.modifiedAt;
	}

	public void setModifiedAt(Date modifiedAt) {
		this.modifiedAt = modifiedAt;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "ressource", cascade={CascadeType.PERSIST,CascadeType.REMOVE})
	public Set<Like> getLikes() {
		return this.likes;
	}

	public void setLikes(Set<Like> likes) {
		this.likes = likes;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "ressource", cascade={CascadeType.PERSIST,CascadeType.REMOVE})
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

}
